﻿<!--left-->
<div class="content_slide">
    <div class="select_owner w_11 mr_1" data-meta="{value:'@ViewBag.PrototypeId',name:'PrototypeId', btn:'<span class=\'ico ico_slide_down\'></span>' , clickbtn:'<span class=\'ico ico_slide_up\'></span>'}">
        <ul>
            <li data-value="0"><a href="/m/node/listNode">全部</a></li>
            @foreach (var item in @ViewBag.PrototypeList) {
                <li data-value="@item.Id"><a href="/m/node/listNode?PrototypeId=@item.Id">@item.Title</a>
                </li>
            }
        </ul>
    </div>
    <div class="nav_left">
        <div class="border-top1 pb_1"></div>
        <ul class="" id="menuTree"></ul>
    </div>
</div>
<input type="hidden" class="j_prototypeId" value="@ViewBag.PrototypeId"/>
<textarea style="display: none;" id="menu_tree">@ViewBag.CategoryData</textarea>
<script type="text/javascript">
    $(document).ready(function () {
        var zNodes = jQuery.parseJSON($('#menu_tree').val());
        function addDiyDom(treeId, treeNode) {
            var spanObj = $("#" + treeNode.tId + '_span');
            if (treeNode.pId == null) {
                @Html.Raw(ViewBag.PrototypeId > 0 ? "spanObj.parent().attr('href', '" + Model["url"] + "' + treeNode.id+'&prototypeId=" + ViewBag.PrototypeId + "')" : "");
                spanObj.parent().attr("target", null);
                spanObj.addClass("tree_ico");
                spanObj.empty();
                spanObj.after(treeNode.name);
            } else {
               @Html.Raw(ViewBag.PrototypeId > 0 ? "spanObj.parent().attr('href', '" + Model["url"] + "' + treeNode.id+'&prototypeId=" + ViewBag.PrototypeId + "')" : "spanObj.parent().attr('href', '/m/node/addPrototypeIdLink?categoryId='+ treeNode.id)")
                spanObj.parent().attr("target", null);
                spanObj.parent().parent().parent().css("display", "none");
                spanObj.after(treeNode.name);
                spanObj.remove();
            }

            if (treeNode.checked == true) {
                var liObj = $("#" + treeNode.tId);
                var $liObj = liObj;
                $liObj.addClass("current");
            }
        }
        jQuery.fn.zTree.init($("#menuTree"), {
            view: {
                showLine: false,
                showIcon: false,
                selectedMulti: false,
                dblClickExpand: false,
                addDiyDom: addDiyDom
            },
            data: { simpleData: { enable: true } },
            callback: {
            }
        }, zNodes);
        $('span.button').remove();
    })
</script>
